##配置TaskingC编译器
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR "TriCore")
set(CMAKE_C_COMPILER_ID "Tasking")
set(CMAKE_C_COMPILER  "cctc")
set(CMAKE_CXX_COMPILER  "cptc")
set(CMAKE_AR "artc")
set(CMAKE_ASM_COMPILER  "astc")
set(CMAKE_LINKER  "cctc")

# SET(CMAKE_C_COMPILER_WORKS 1 CACHE INTERNAL "")
# SET(CMAKE_CXX_COMPILER_WORKS 1 CACHE INTERNAL "")
# SET(CMAKE_C_COMPILER_WORKS TRUE CACHE INTERNAL "")
# SET(CMAKE_CXX_COMPILER_WORKS TRUE CACHE INTERNAL "")
# SET(CMAKE_C_COMPILER_FORCED TRUE CACHE INTERNAL "")
# SET(CMAKE_CXX_COMPILER_FORCED TRUE CACHE INTERNAL "")
# SET(CMAKE_C_COMPILER_ID_RUN TRUE CACHE INTERNAL "")
# SET(CMAKE_CXX_COMPILER_ID_RUN TRUE CACHE INTERNAL "")
# Optionally reduce compiler sanity check when cross-compiling.
# set(CMAKE_TRY_COMPILE_TARGET_TYPE         STATIC_LIBRARY)
# set(CMAKE_FIND_ROOT_PATH)
# set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
# set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

set(CMAKE_ASM_FLAGS "-Og -Os --no-warnings= --error-limit=42 --list-format=L1 --optimize=gs")

set(CMAKE_C_COMPILE_OBJECT
  "${CMAKE_C_COMPILER} <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>.src <SOURCE>"
  "${CMAKE_ASM_COMPILER} -o <OBJECT> <OBJECT>.src ${CMAKE_ASM_FLAGS}")

set(CMAKE_CXX_COMPILE_OBJECT
  "${CMAKE_CXX_COMPILER} <DEFINES> <INCLUDE> ${CMAKE_CXX_FLAGS} -o <OBJECT>.ic <SOURCE>"
  "${CMAKE_C_COMPILER} <DEFINES> <INCLUDES> ${CMAKE_C_FLAGS} -o <OBJECT>.src <OBJECT>.ic"
  "${CMAKE_ASM_COMPILER} -o <OBJECT> <OBJECT>.src ${CMAKE_ASM_FLAGS}")

set(CMAKE_C_CREATE_STATIC_LIBRARY
  "${CMAKE_AR} -rvn <TARGET> <LINK_FLAGS> <OBJECTS>")

set(CMAKE_C_LINK_EXECUTABLE "${CMAKE_LINKER} <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET> <OBJECTS>")
set(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE})

# Set suffix of binary
set(CMAKE_EXECUTABLE_SUFFIX_C        .elf)
set(CMAKE_EXECUTABLE_SUFFIX_CXX      .elf)
set(CMAKE_C_OUTPUT_EXTENSION         .o)
set(CMAKE_CXX_OUTPUT_EXTENSION       .o)
set(CMAKE_STATIC_LIBRARY_SUFFIX_C    .a)
set(CMAKE_STATIC_LIBRARY_SUFFIX_CXX  .a)